package com.jack.lib.net.interceptor

import com.jack.lib.core.utils.JLog
import com.jack.lib.net.JNetManager
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor

/**
 * author : chong.huang
 * create : 2021/12/30
 * desc   :
 */
class JLoggingInterceptor : Interceptor {

    private val interceptor = HttpLoggingInterceptor { print(it) }.also {
        it.level = HttpLoggingInterceptor.Level.BASIC
    }

    override fun intercept(chain: Interceptor.Chain): Response {
        return interceptor.intercept(chain)
    }

    private fun print(message: String) {
        JLog.i(JNetManager.TAG, message)
    }
}